//
//  XKMineAboutUsHeaderCell.m
//  XKJY
//
//  Created by xuyaguang on 2017/1/12.
//  Copyright © 2017年 xiaokang100. All rights reserved.
//

#import "XKMineAboutUsHeaderCell.h"


@interface XKMineAboutUsHeaderCell ()

@property(nonatomic, strong) UIImageView    *logoImageView;
@property(nonatomic, strong) UILabel        *informationLabel;

@end
@implementation XKMineAboutUsHeaderCell

#pragma mark - 自定义cell重写构造方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self configArguments];
        [self createSubviews];
        [self addConstraints];
    }
    return self;
}

#pragma mark - 设置自身
- (void)configArguments {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = kBaseGrayColor;
}

#pragma mark - 创建控件
- (void)createSubviews {
    
    
    self.logoImageView = [UIImageView new];
    self.logoImageView.image = [UIImage imageNamed:@"about_con_icon_logo"];
    
    
    // 富文本
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    paragraphStyle.lineSpacing = 8*Scale_H;//行间距
    paragraphStyle.firstLineHeadIndent = 26*Scale_W;//首行缩进
    paragraphStyle.alignment = NSTextAlignmentJustified;// 两端对齐
    paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;//结尾部分的内容以……省略
    paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;//从左到右的书写方向（一共三种）
    
    NSDictionary *attributes = @{
                                 NSFontAttributeName:[UIFont systemFontOfSize:13*Scale_W],// 字号
                                 NSParagraphStyleAttributeName:paragraphStyle,// 段落样式
                                 NSForegroundColorAttributeName:GrayColor,// 字体颜色
                                 };
    self.informationLabel = [[UILabel alloc] init];
    self.informationLabel.numberOfLines = 0;
    self.informationLabel.attributedText = [[NSAttributedString alloc] initWithString:@"小康100致力于经营创新型互联网业务，以“创新、服务和安全” 为核心经营理念，不断研发新型互联网服务产品，服务于广大终端用户，在不断提高用户体验的过程中提升公司价值。" attributes:attributes];
    
}
#pragma mark - 添加约束
- (void)addConstraints {
    
    
    [self.contentView addSubview:self.logoImageView];
    [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView);
        make.top.mas_equalTo(self.contentView).offset(20*Scale_H);
        make.size.mas_equalTo(CGSizeMake(74*Scale_W, 73*Scale_W));
    }];
    
    
    [self.contentView addSubview:self.informationLabel];
    [self.informationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).offset(20*Scale_W);
        make.right.mas_equalTo(self.contentView).offset(-20*Scale_W);
        make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(10*Scale_H);
        make.bottom.mas_equalTo(self.contentView).offset(-20*Scale_H).priorityHigh();
    }];
}

@end
